Optimal. Leaf size=216 \[ \frac {5 (11 i A-5 B) x}{8 a^3}+\frac {5 (11 i A-5 B) \cot (c+d x)}{8 a^3 d}-\frac {(7 A+3 i B) \cot ^2(c+d x)}{2 a^3 d}-\frac {(7 A+3 i B) \log (\sin (c+d x))}{a^3 d}+\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.41, antiderivative size = 216, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 4, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3677, 3610,
3612, 3556} \begin {gather*} -\frac {(7 A+3 i B) \cot ^2(c+d x)}{2 a^3 d}+\frac {5 (-5 B+11 i A) \cot (c+d x)}{8 a^3 d}-\frac {(7 A+3 i B) \log (\sin (c+d x))}{a^3 d}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {5 x (-5 B+11 i A)}{8 a^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3610
Rule 3612
Rule 3677
Rubi steps
\begin {align*} \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx &=\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {\int \frac {\cot ^3(c+d x) (2 a (4 A+i B)-5 a (i A-B) \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx}{6 a^2}\\ &=\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {\int \frac {\cot ^3(c+d x) \left (2 a^2 (29 A+11 i B)-4 a^2 (13 i A-7 B) \tan (c+d x)\right )}{a+i a \tan (c+d x)} \, dx}{24 a^4}\\ &=\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {\int \cot ^3(c+d x) \left (48 a^3 (7 A+3 i B)-30 a^3 (11 i A-5 B) \tan (c+d x)\right ) \, dx}{48 a^6}\\ &=-\frac {(7 A+3 i B) \cot ^2(c+d x)}{2 a^3 d}+\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {\int \cot ^2(c+d x) \left (-30 a^3 (11 i A-5 B)-48 a^3 (7 A+3 i B) \tan (c+d x)\right ) \, dx}{48 a^6}\\ &=\frac {5 (11 i A-5 B) \cot (c+d x)}{8 a^3 d}-\frac {(7 A+3 i B) \cot ^2(c+d x)}{2 a^3 d}+\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {\int \cot (c+d x) \left (-48 a^3 (7 A+3 i B)+30 a^3 (11 i A-5 B) \tan (c+d x)\right ) \, dx}{48 a^6}\\ &=\frac {5 (11 i A-5 B) x}{8 a^3}+\frac {5 (11 i A-5 B) \cot (c+d x)}{8 a^3 d}-\frac {(7 A+3 i B) \cot ^2(c+d x)}{2 a^3 d}+\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )}-\frac {(7 A+3 i B) \int \cot (c+d x) \, dx}{a^3}\\ &=\frac {5 (11 i A-5 B) x}{8 a^3}+\frac {5 (11 i A-5 B) \cot (c+d x)}{8 a^3 d}-\frac {(7 A+3 i B) \cot ^2(c+d x)}{2 a^3 d}-\frac {(7 A+3 i B) \log (\sin (c+d x))}{a^3 d}+\frac {(A+i B) \cot ^2(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(13 A+7 i B) \cot ^2(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {5 (11 A+5 i B) \cot ^2(c+d x)}{24 d \left (a^3+i a^3 \tan (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(1448\) vs. \(2(216)=432\).
time = 7.16, size = 1448, normalized size = 6.70 \begin {gather*} \frac {(9 A+7 i B) \cos (4 d x) \sec ^2(c+d x) \left (-\frac {\cos (c)}{32}+\frac {1}{32} i \sin (c)\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {(39 A+23 i B) \cos (2 d x) \sec ^2(c+d x) \left (-\frac {\cos (c)}{16}-\frac {1}{16} i \sin (c)\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {\sec ^2(c+d x) \left (7 A \cos \left (\frac {3 c}{2}\right )+3 i B \cos \left (\frac {3 c}{2}\right )+7 i A \sin \left (\frac {3 c}{2}\right )-3 B \sin \left (\frac {3 c}{2}\right )\right ) \left (i \text {ArcTan}(\tan (d x)) \cos \left (\frac {3 c}{2}\right )-\text {ArcTan}(\tan (d x)) \sin \left (\frac {3 c}{2}\right )\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {\sec ^2(c+d x) \left (7 A \cos \left (\frac {3 c}{2}\right )+3 i B \cos \left (\frac {3 c}{2}\right )+7 i A \sin \left (\frac {3 c}{2}\right )-3 B \sin \left (\frac {3 c}{2}\right )\right ) \left (-\frac {1}{2} \cos \left (\frac {3 c}{2}\right ) \log \left (\sin ^2(c+d x)\right )-\frac {1}{2} i \log \left (\sin ^2(c+d x)\right ) \sin \left (\frac {3 c}{2}\right )\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {x \sec ^2(c+d x) (14 i A \cos (c)-6 B \cos (c)+7 A \cos (c) \cot (c)+3 i B \cos (c) \cot (c)-7 A \sin (c)-3 i B \sin (c)+(7 A+3 i B) \cot (c) (-\cos (3 c)-i \sin (3 c))) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{(A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {(A+i B) \cos (6 d x) \sec ^2(c+d x) \left (-\frac {1}{48} \cos (3 c)+\frac {1}{48} i \sin (3 c)\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {\csc ^2(c+d x) \sec ^2(c+d x) \left (-\frac {1}{2} A \cos (3 c)-\frac {1}{2} i A \sin (3 c)\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {(11 A+5 i B) \sec ^2(c+d x) \left (\frac {5}{8} i d x \cos (3 c)-\frac {5}{8} d x \sin (3 c)\right ) (\cos (d x)+i \sin (d x))^3 (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {(39 A+23 i B) \sec ^2(c+d x) \left (\frac {1}{16} i \cos (c)-\frac {\sin (c)}{16}\right ) (\cos (d x)+i \sin (d x))^3 \sin (2 d x) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {(9 A+7 i B) \sec ^2(c+d x) \left (\frac {1}{32} i \cos (c)+\frac {\sin (c)}{32}\right ) (\cos (d x)+i \sin (d x))^3 \sin (4 d x) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {(A+i B) \sec ^2(c+d x) \left (\frac {1}{48} i \cos (3 c)+\frac {1}{48} \sin (3 c)\right ) (\cos (d x)+i \sin (d x))^3 \sin (6 d x) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3}+\frac {\csc \left (\frac {c}{2}\right ) \csc (c+d x) \sec \left (\frac {c}{2}\right ) \sec ^2(c+d x) (\cos (d x)+i \sin (d x))^3 \left (\frac {3}{2} A \cos (3 c-d x)+\frac {1}{2} i B \cos (3 c-d x)-\frac {3}{2} A \cos (3 c+d x)-\frac {1}{2} i B \cos (3 c+d x)+\frac {3}{2} i A \sin (3 c-d x)-\frac {1}{2} B \sin (3 c-d x)-\frac {3}{2} i A \sin (3 c+d x)+\frac {1}{2} B \sin (3 c+d x)\right ) (A+B \tan (c+d x))}{2 d (A \cos (c+d x)+B \sin (c+d x)) (a+i a \tan (c+d x))^3} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.34, size = 153, normalized size = 0.71
method | result | size |
derivativedivides | \(\frac {\left (-3 i B -7 A \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {-3 i A +B}{\tan \left (d x +c \right )}-\frac {A}{2 \tan \left (d x +c \right )^{2}}-\frac {-\frac {7 A}{4}-\frac {5 i B}{4}}{2 \left (\tan \left (d x +c \right )-i\right )^{2}}+\left (\frac {49 i B}{16}+\frac {111 A}{16}\right ) \ln \left (\tan \left (d x +c \right )-i\right )-\frac {-\frac {31 i A}{8}+\frac {17 B}{8}}{\tan \left (d x +c \right )-i}-\frac {\frac {i A}{2}-\frac {B}{2}}{3 \left (\tan \left (d x +c \right )-i\right )^{3}}+\left (\frac {A}{16}-\frac {i B}{16}\right ) \ln \left (\tan \left (d x +c \right )+i\right )}{d \,a^{3}}\) | \(153\) |
default | \(\frac {\left (-3 i B -7 A \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {-3 i A +B}{\tan \left (d x +c \right )}-\frac {A}{2 \tan \left (d x +c \right )^{2}}-\frac {-\frac {7 A}{4}-\frac {5 i B}{4}}{2 \left (\tan \left (d x +c \right )-i\right )^{2}}+\left (\frac {49 i B}{16}+\frac {111 A}{16}\right ) \ln \left (\tan \left (d x +c \right )-i\right )-\frac {-\frac {31 i A}{8}+\frac {17 B}{8}}{\tan \left (d x +c \right )-i}-\frac {\frac {i A}{2}-\frac {B}{2}}{3 \left (\tan \left (d x +c \right )-i\right )^{3}}+\left (\frac {A}{16}-\frac {i B}{16}\right ) \ln \left (\tan \left (d x +c \right )+i\right )}{d \,a^{3}}\) | \(153\) |
risch | \(-\frac {49 x B}{8 a^{3}}+\frac {111 i x A}{8 a^{3}}-\frac {23 i {\mathrm e}^{-2 i \left (d x +c \right )} B}{16 a^{3} d}-\frac {39 \,{\mathrm e}^{-2 i \left (d x +c \right )} A}{16 a^{3} d}-\frac {7 i {\mathrm e}^{-4 i \left (d x +c \right )} B}{32 a^{3} d}-\frac {9 \,{\mathrm e}^{-4 i \left (d x +c \right )} A}{32 a^{3} d}-\frac {i {\mathrm e}^{-6 i \left (d x +c \right )} B}{48 a^{3} d}-\frac {{\mathrm e}^{-6 i \left (d x +c \right )} A}{48 a^{3} d}-\frac {6 B c}{a^{3} d}+\frac {14 i A c}{a^{3} d}-\frac {2 i \left (-2 i A \,{\mathrm e}^{2 i \left (d x +c \right )}+B \,{\mathrm e}^{2 i \left (d x +c \right )}+3 i A -B \right )}{a^{3} d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {3 i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{a^{3} d}-\frac {7 A \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{a^{3} d}\) | \(246\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.51, size = 235, normalized size = 1.09 \begin {gather*} -\frac {12 \, {\left (-111 i \, A + 49 \, B\right )} d x e^{\left (10 i \, d x + 10 i \, c\right )} + 6 \, {\left (4 \, {\left (111 i \, A - 49 \, B\right )} d x + 103 \, A + 55 i \, B\right )} e^{\left (8 i \, d x + 8 i \, c\right )} + 3 \, {\left (4 \, {\left (-111 i \, A + 49 \, B\right )} d x - 339 \, A - 149 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + 14 \, {\left (13 \, A + 7 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (23 \, A + 17 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 96 \, {\left ({\left (7 \, A + 3 i \, B\right )} e^{\left (10 i \, d x + 10 i \, c\right )} - 2 \, {\left (7 \, A + 3 i \, B\right )} e^{\left (8 i \, d x + 8 i \, c\right )} + {\left (7 \, A + 3 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) + 2 \, A + 2 i \, B}{96 \, {\left (a^{3} d e^{\left (10 i \, d x + 10 i \, c\right )} - 2 \, a^{3} d e^{\left (8 i \, d x + 8 i \, c\right )} + a^{3} d e^{\left (6 i \, d x + 6 i \, c\right )}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 1.21, size = 398, normalized size = 1.84 \begin {gather*} \frac {6 A + 2 i B + \left (- 4 A e^{2 i c} - 2 i B e^{2 i c}\right ) e^{2 i d x}}{a^{3} d e^{4 i c} e^{4 i d x} - 2 a^{3} d e^{2 i c} e^{2 i d x} + a^{3} d} + \begin {cases} \frac {\left (\left (- 512 A a^{6} d^{2} e^{6 i c} - 512 i B a^{6} d^{2} e^{6 i c}\right ) e^{- 6 i d x} + \left (- 6912 A a^{6} d^{2} e^{8 i c} - 5376 i B a^{6} d^{2} e^{8 i c}\right ) e^{- 4 i d x} + \left (- 59904 A a^{6} d^{2} e^{10 i c} - 35328 i B a^{6} d^{2} e^{10 i c}\right ) e^{- 2 i d x}\right ) e^{- 12 i c}}{24576 a^{9} d^{3}} & \text {for}\: a^{9} d^{3} e^{12 i c} \neq 0 \\x \left (- \frac {111 i A - 49 B}{8 a^{3}} + \frac {\left (111 i A e^{6 i c} + 39 i A e^{4 i c} + 9 i A e^{2 i c} + i A - 49 B e^{6 i c} - 23 B e^{4 i c} - 7 B e^{2 i c} - B\right ) e^{- 6 i c}}{8 a^{3}}\right ) & \text {otherwise} \end {cases} + \frac {x \left (111 i A - 49 B\right )}{8 a^{3}} - \frac {\left (7 A + 3 i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a^{3} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.36, size = 211, normalized size = 0.98 \begin {gather*} \frac {\frac {6 \, {\left (111 \, A + 49 i \, B\right )} \log \left (i \, \tan \left (d x + c\right ) + 1\right )}{a^{3}} + \frac {6 \, {\left (A - i \, B\right )} \log \left (i \, \tan \left (d x + c\right ) - 1\right )}{a^{3}} - \frac {96 \, {\left (7 \, A + 3 i \, B\right )} \log \left (\tan \left (d x + c\right )\right )}{a^{3}} + \frac {48 \, {\left (21 \, A \tan \left (d x + c\right )^{2} + 9 i \, B \tan \left (d x + c\right )^{2} + 6 i \, A \tan \left (d x + c\right ) - 2 \, B \tan \left (d x + c\right ) - A\right )}}{a^{3} \tan \left (d x + c\right )^{2}} + \frac {1221 i \, A \tan \left (d x + c\right )^{3} - 539 \, B \tan \left (d x + c\right )^{3} + 4035 \, A \tan \left (d x + c\right )^{2} + 1821 i \, B \tan \left (d x + c\right )^{2} - 4491 i \, A \tan \left (d x + c\right ) + 2085 \, B \tan \left (d x + c\right ) - 1693 \, A - 819 i \, B}{a^{3} {\left (i \, \tan \left (d x + c\right ) + 1\right )}^{3}}}{96 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.14, size = 221, normalized size = 1.02 \begin {gather*} -\frac {\frac {A}{2\,a^3}+{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (-\frac {63\,B}{8\,a^3}+\frac {A\,137{}\mathrm {i}}{8\,a^3}\right )+{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {149\,A}{12\,a^3}+\frac {B\,71{}\mathrm {i}}{12\,a^3}\right )-{\mathrm {tan}\left (c+d\,x\right )}^4\,\left (\frac {55\,A}{8\,a^3}+\frac {B\,25{}\mathrm {i}}{8\,a^3}\right )-\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {B}{a^3}+\frac {A\,3{}\mathrm {i}}{2\,a^3}\right )}{d\,\left (-{\mathrm {tan}\left (c+d\,x\right )}^5\,1{}\mathrm {i}-3\,{\mathrm {tan}\left (c+d\,x\right )}^4+{\mathrm {tan}\left (c+d\,x\right )}^3\,3{}\mathrm {i}+{\mathrm {tan}\left (c+d\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (7\,A+B\,3{}\mathrm {i}\right )}{a^3\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{16\,a^3\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (111\,A+B\,49{}\mathrm {i}\right )}{16\,a^3\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________